package ltd.hxya.novel.book.controller;

import ltd.hxya.novel.common.constant.rabbit.RabbitConstant;
import ltd.hxya.novel.common.to.notice.Notice;
import org.springframework.amqp.rabbit.connection.RabbitUtils;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.time.LocalDateTime;

@Controller
public class BookBaseController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    //保存通知
    public void saveAdminNotice(String message) {
        Notice notice = new Notice();
        notice.setNoticeMessage(message);
        rabbitTemplate.convertAndSend(RabbitConstant.ADMIN_NOTICE_EXCHANGE,RabbitConstant.ADMIN_NOTICE_ROUTING_KEY,notice);
    }
}
